﻿Imports System.Windows.Media
Imports System.Windows.Forms.Integration
Imports System.Windows


Public Class AffichageRadio
    Public Function Affiche(ByVal largeurmax As Integer, ByVal texte As String) As Integer
        LeTexte.Text = texte & " "
        Me.UpdateLayout()
        Dim textwidth As Double = LeTexte.ActualWidth
        Dim textwidthapresratio As Double = textwidth + Image1.Width
        If textwidthapresratio > largeurmax Then
            Me.Width = largeurmax
            GridControl.ColumnDefinitions(1).Width = New GridLength((largeurmax) - TroisPetitsPoints.ActualWidth - Image1.Width, GridUnitType.Pixel)
        Else
            Me.Width = textwidthapresratio
            GridControl.ColumnDefinitions(1).Width = New GridLength(textwidth, GridUnitType.Auto)

        End If
        Me.UpdateLayout()
        Return Math.Min(largeurmax, CInt(textwidthapresratio))
    End Function
End Class
